package com.lotto.manager.admin.system;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.lotto.manager.admin.entity.db.Alloc;
import com.lotto.manager.admin.entity.db.Astrict;
import com.lotto.manager.admin.entity.db.Game;
import com.lotto.manager.admin.entity.db.Item;
import com.lotto.manager.admin.entity.db.Kithe;
import com.lotto.manager.admin.entity.db.Odds;
import com.lotto.manager.admin.entity.db.Play;
import com.lotto.manager.admin.entity.db.SysConfig;
import com.lotto.manager.common.constant.SystemConstant;


public class SystemData {
	//===============系统值=====================
	private static SysConfig sysConfig;
	
	// 生肖
	public static Map<String, String> zodiacNumber = new HashMap<String, String>();
	// 五行
	public static Map<String, String> wuXingNumber = new HashMap<String, String>();
	// 波色
	public static Map<String, String> colorNumber = new HashMap<String, String>();
	// 合数单双
	public static Map<String, String> sunSingleDoubleNumber = new HashMap<String, String>();
	// 单双
	public static Map<String, String> singleDoubleNumber = new HashMap<String, String>();
	// 大小
	public static Map<String, String> bigSmallNumber = new HashMap<String, String>();
	
	
	public static SysConfig getSysConfig() {
		return sysConfig;
	}

	public static void addSysConfig(SysConfig sysConfig) {
		SystemData.sysConfig = sysConfig;
	}
	

	//=========================玩法========================
	private static Map<Integer,Game> games = new HashMap<Integer,Game>(); 
	
	private static Map<Integer,Play> plays = new HashMap<Integer,Play>(); 

	private static Map<Integer,Item> items = new HashMap<Integer,Item>(); 
	
	
	
	public static Item findItem(Integer key){
		return items.get(key);
	}

	public static void addtem(Integer key,Item item){
		items.put(key, item);
	}
	
	
	public static Play findPlay(Integer key){
		return plays.get(key);
	}
	
	public static void addPlay(Integer key,Play play){
		plays.put(key, play);
	}
	
	public static Game findGame(Integer key){
		return games.get(key);
	}
	
	public static void addGame(Integer key,Game game){
		games.put(key, game);
	}
	
	
	
	//========================期号=======================
	public static Integer maxentries = 0;
	
	private static Kithe lastKithen = null;
/*	
	private static List<Kithe> kithens = new ArrayList<Kithe>(); */
	
	private static Map<String,List<Kithe>> pageHistory = new ConcurrentHashMap<String,List<Kithe>>();
	
	/*public static List<Kithe> getKithens() {
		return kithens;
	}

	public static void setKithens(List<Kithe> kithens) {
		SystemData.kithens = kithens;
	}*/
	
	public static Kithe getLastKithen() {
		return lastKithen;
	}

	public static void setLastKithen(Kithe lastKithen) {
		SystemData.lastKithen = lastKithen;
	}

	public static void addHistoryList(int page,List<Kithe> kithes){
		pageHistory.put(SystemConstant.CACHE_KITHE_PAGE_KEY+page, kithes);
	}
	
	public static List<Kithe> getHistoryList(int currentPage){
		return pageHistory.get(SystemConstant.CACHE_KITHE_PAGE_KEY+currentPage);
	}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	


	

	//====================Astrict=============================
	private static Map<String,Astrict> astricts = new ConcurrentHashMap<String,Astrict>();
	
	
	public static Astrict findAstrictByKey(String key){
		return astricts.get(key);
	}
	
	public static void addAstrict(String key,Astrict astrict){
		astricts.put(key, astrict);
	}
	
	
	//========================user=========================
	private static Map<Integer,Alloc> allocs = new ConcurrentHashMap<Integer,Alloc>();	
	
	public static Alloc findAllocByUserid(Integer userid){
		return allocs.get(userid);
	}
	
	public static void addAlloc(Integer userid,Alloc alloc){
		allocs.put(userid, alloc);
	}
	
	//========================odds=========================
	private static Map<Integer,Odds> oddss = new ConcurrentHashMap<Integer,Odds>();	

	public static Odds findOddsByItemid(Integer itemid){
		return oddss.get(itemid);
	}
	
	public static void addOdds(Integer itemid,Odds odds){
		oddss.put(itemid, odds);
	}
}
